<%@ WebHandler Language="C#" Class="Selected" %>

using System;
using System.Web;
using System.Data.SqlClient;
public class Selected : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/xml";
       
        context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
        context.Response.Cache.SetNoStore();
        context.Response.Cache.SetExpires(DateTime.MinValue);
        SqlConnection con = new SqlConnection();
        con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;//ConnectionString
        con.Open();
        //get all movies that are not selected
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = con;
        cmd.CommandText = "SELECT ID_MOVIE,TITLE" +
                          "  FROM TB_SELECTED_MOVIE" +
                          " ORDER BY ID_MOVIE";

        SqlDataReader _reader = cmd.ExecuteReader();
        string sXml = Util.ReaderToXML(_reader);
        _reader.Close();
        _reader.Dispose();
        con.Close();
        cmd.Dispose();
        con.Dispose();
        context.Response.Write(sXml);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}